//index.js
const Controllers = require('../../controllers/Controller.js').controller;
const app = getApp();
Page({
  data: {
    title: '代理商详情',
    details: {}
  },
  agentDetail() {
    var that = this;
    Controllers.agentDetail({ agentId: that.data.id }).then(res => {
      console.log('agentDetail--res==', res);
      const { code, data, desc } = res;
      that.setData({
        details: data
      })
    })
  },
  onLoad(options) {
    var that = this;
    that.setData({
      id: parseInt(options.id),
      title: options.title || '代理商详情'
    })

  },
  onShow() {
    var that = this;
    var agentIndexData = wx.getStorageSync('agentIndex');
    console.log('onShow--agentIndexData==', agentIndexData);
    
    that.setData({
      agentIndexData
    })
    that.agentDetail();

  }
})